import request from '@/utils/request'

// 创建用户地址
export function createAddress(data) {
  return request({
    url: '/mini/address/create',
    method: 'post',
    data: data
  })
}

// 更新用户地址
export function updateAddress(data) {
  return request({
    url: '/mini/address/update',
    method: 'put',
    data: data
  })
}

// 删除用户地址
export function deleteAddress(id) {
  return request({
    url: '/mini/address/delete?id=' + id,
    method: 'delete'
  })
}

// 获得用户地址
export function getAddress(id) {
  return request({
    url: '/mini/address/get?id=' + id,
    method: 'get'
  })
}

// 获得用户地址分页
export function getAddressPage(query) {
  return request({
    url: '/mini/address/page',
    method: 'get',
    params: query
  })
}

// 导出用户地址 Excel
export function exportAddressExcel(query) {
  return request({
    url: '/mini/address/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
